Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NSIB support for nRF54LX series #16765

Merged
merged 10 commits into from
Nov 5, 2024
Merged

Conversation

michalek-no
Copy link
Contributor

duplicate of #16079 due to CI failing over contributing author.

@github-actions github-actions bot added the doc-required PR must not be merged without tech writer approval. label Aug 6, 2024
@NordicBuilder
Copy link
Contributor

NordicBuilder commented Aug 6, 2024

Test specification

CI/Jenkins/NRF

  • Integration Platforms

CI/Jenkins/integration

Test Module File based changes Manually selected West overwrite
desktop52_verification X
doc-internal X
test-fw-nrfconnect-apps X
test-fw-nrfconnect-ble_mesh X
test-fw-nrfconnect-ble_samples X
test-fw-nrfconnect-boot X
test-fw-nrfconnect-chip X
test-fw-nrfconnect-fem X
test-fw-nrfconnect-nfc X
test-fw-nrfconnect-nrf-iot_cloud X
test-fw-nrfconnect-nrf-iot_libmodem-nrf X
test-fw-nrfconnect-nrf-iot_lwm2m X
test-fw-nrfconnect-nrf-iot_mosh X
test-fw-nrfconnect-nrf-iot_nrf_provisioning X X
test-fw-nrfconnect-nrf-iot_positioning X
test-fw-nrfconnect-nrf-iot_samples X
test-fw-nrfconnect-nrf-iot_serial_lte_modem X
test-fw-nrfconnect-nrf-iot_thingy91 X
test-fw-nrfconnect-nrf-iot_zephyr_lwm2m X
test-fw-nrfconnect-nrf_crypto X
test-fw-nrfconnect-proprietary_esb X
test-fw-nrfconnect-ps X
test-fw-nrfconnect-rpc X
test-fw-nrfconnect-rs X
test-fw-nrfconnect-tfm X
test-fw-nrfconnect-thread X
test-fw-nrfconnect-zigbee X
test-low-level X
test-sdk-audio X
test-sdk-dfu X
test-sdk-find-my X
test-sdk-mcuboot X
test-sdk-pmic-samples X
test-sdk-sidewalk X
test-sdk-wifi X
test_ble_commit X

All integration tests: null

Detailed information of selected test modules

Note: This message is automatically posted and updated by the CI

@NordicBuilder
Copy link
Contributor

You can find the documentation preview for this PR at this link. It will be updated about 10 minutes after the documentation build succeeds.

Note: This comment is automatically posted by the Documentation Publishing GitHub Action.

Copy link
Contributor

@oyvindronningstad oyvindronningstad left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Addititionally, please add the new platform(s) to tests/subsys/bootloader/bl_storage/testcase.yaml and update tests/subsys/bootloader/bl_storage/src/main.c to use the new typedefs.

if (IS_ENABLED(CONFIG_FPROTECT)) {
err = fprotect_area(PM_B0_ADDRESS, PM_B0_SIZE);
} else {
printk("Fprotect disabled. No protection applied.\n\r");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When is this relevant? Is it even a valid configuration, or should if fail more loudly?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nRF54l15 won't use runtime setup for memory overwrite protection.

@@ -132,6 +131,8 @@ def parse_args():
help="The MCUBOOT bootloader is used without the NSIB bootloader. Only the provision address, the MCUBOOT counters and the MCUBOOT counters slots arguments will be used.")
parser.add_argument('--mcuboot-counters-slots', required=False, type=int, default=0,
help='Number of monotonic counter slots for every MCUBOOT counter.')
parser.add_argument('--lcs-state-size', required=False, type=lambda x: int(x, 0), default=0x8,
help='Number of monotonic counter slots for every MCUBOOT counter.')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

helptext needs updating

@@ -153,8 +154,13 @@ def get_hashes(public_key_files, verify_hashes):


def main():
global lcs_state_size
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this should be refactored to not be a global variable. Making it a parameter to generate_mcuboot_only_provision_hex_file should be enough.

uint16_t secure;
lcs_data_t provisioning;
lcs_data_t secure;
#ifdef CONFIG_NRFX_NVMC
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if it's a good idea to remove the padding. It's not needed for padding purposes, but will be needed if another state is added. Maybe @Vge0rge can chime in.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe worth to add reserved for future usage field for RRAM based device as well then.
Just in case.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree that it's better to have a reserve word there in case we want to support another state later.

@@ -238,6 +290,87 @@ NRFX_STATIC_INLINE void read_implementation_id_from_otp(uint8_t *buf)
* This is a temporary solution until TF-M has access to NSIB functions.
*/

#ifdef CONFIG_NRFX_RRAMC
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Most of the added functions are basically internal functions, so I think it's less than ideal to have them in the header file. I guess there's precedent for it in this file though, so maybe not in scope to fix here, but maybe just give it a second thought.

Copy link
Contributor

@nvlsianpu nvlsianpu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

checked that requests from original PR were fulfilled.

@NordicBuilder
Copy link
Contributor

NordicBuilder commented Aug 16, 2024

CI Information

To view the history of this post, clich the 'edited' button above
Build number: 51

Inputs:

Sources:

sdk-nrf: PR head: 74cce6bc8c325137702fa6207d9aef3f0eb3ef94

more details

sdk-nrf:

PR head: 74cce6bc8c325137702fa6207d9aef3f0eb3ef94
merge base: 9e61aa7cab4435aba07b1eae019f7fb4ae2adaf2
target head (main): b5c963c841111e4ad93b52e05d9755141b03c3af
Diff

Github labels

Enabled Name Description
ci-disabled Disable the ci execution
ci-all-test Run all of ci, no test spec filtering will be done
ci-force-downstream Force execution of downstream even if twister fails
ci-run-twister Force run twister
ci-run-zephyr-twister Force run zephyr twister
List of changed files detected by CI (25)
cmake
│  ├── partition_manager.cmake
│  ├── sysbuild
│  │  ├── partition_manager.cmake
│  │  │ provision_hex.cmake
doc
│  ├── nrf
│  │  ├── libraries
│  │  │  ├── security
│  │  │  │  ├── bootloader
│  │  │  │  │  │ fw_info.rst
include
│  ├── bl_storage.h
│  ├── bl_validation.h
│  ├── fw_info.h
│  │ fw_info_bare.h
lib
│  ├── fprotect
│  │  │ Kconfig
│  ├── hw_unique_key
│  │  │ Kconfig
samples
│  ├── bootloader
│  │  ├── prj.conf
│  │  ├── prj_minimal.conf
│  │  ├── src
│  │  │  │ main.c
scripts
│  ├── bootloader
│  │  │ provision.py
subsys
│  ├── bootloader
│  │  ├── Kconfig
│  │  ├── bl_boot
│  │  │  │ bl_boot.c
│  │  ├── bl_storage
│  │  │  ├── Kconfig
│  │  │  │ bl_storage.c
│  │  ├── bl_validation
│  │  │  │ bl_validation.c
│  ├── fw_info
│  │  ├── Kconfig
│  │  │ fw_info.c
│  ├── partition_manager
│  │  │ pm.yml.secure_boot_storage
tests
│  ├── subsys
│  │  ├── bootloader
│  │  │  ├── bl_storage
│  │  │  │  ├── src
│  │  │  │  │  │ main.c
│  │  │  │  │ testcase.yaml
│  │  │  ├── boot_chains
│  │  │  │  │ testcase.yaml

Outputs:

Toolchain

Version: b44b7a08c9
Build docker image: docker-dtr.nordicsemi.no/sw-production/ncs-build:b44b7a08c9_912848a074

Test Spec & Results: ✅ Success; ❌ Failure; 🟠 Queued; 🟡 Progress; ◻️ Skipped; ⚠️ Quarantine

  • ◻️ Toolchain - Skipped: existing toolchain is used
  • ✅ Build twister - Skipped: Skipping Build & Test as it succeeded in a previous run: 50
  • ✅ Integration tests
    • ✅ test-sdk-audio - Skipped: Job was skipped as it succeeded in a previous run
    • ✅ desktop52_verification - Skipped: Job was skipped as it succeeded in a previous run
    • ✅ test-fw-nrfconnect-boot
    • ✅ test-fw-nrfconnect-apps - Skipped: Job was skipped as it succeeded in a previous run
    • ✅ test_ble_nrf_config - Skipped: Job was skipped as it succeeded in a previous run
    • ✅ test-fw-nrfconnect-ble_mesh
    • ✅ test-fw-nrfconnect-ble_samples
    • ✅ test-fw-nrfconnect-chip - Skipped: Job was skipped as it succeeded in a previous run
    • ✅ test-fw-nrfconnect-nfc - Skipped: Job was skipped as it succeeded in a previous run
    • ✅ test-fw-nrfconnect-nrf-iot_cloud - Skipped: Job was skipped as it succeeded in a previous run
    • ✅ test-fw-nrfconnect-nrf-iot_libmodem-nrf - Skipped: Job was skipped as it succeeded in a previous run
    • ✅ test-fw-nrfconnect-nrf-iot_zephyr_lwm2m - Skipped: Job was skipped as it succeeded in a previous run
    • ✅ test-fw-nrfconnect-nrf-iot_samples - Skipped: Job was skipped as it succeeded in a previous run
    • ✅ test-fw-nrfconnect-nrf-iot_lwm2m - Skipped: Job was skipped as it succeeded in a previous run
    • ✅ doc-internal - Skipped: Job was skipped as it succeeded in a previous run
    • ✅ test-fw-nrfconnect-nrf-iot_thingy91 - Skipped: Job was skipped as it succeeded in a previous run
    • ✅ test-fw-nrfconnect-nrf_crypto - Skipped: Job was skipped as it succeeded in a previous run
    • ✅ test-fw-nrfconnect-proprietary_esb - Skipped: Job was skipped as it succeeded in a previous run
    • ✅ test-fw-nrfconnect-rpc - Skipped: Job was skipped as it succeeded in a previous run
    • ✅ test-fw-nrfconnect-rs - Skipped: Job was skipped as it succeeded in a previous run
    • ✅ test-fw-nrfconnect-fem
    • ✅ test-fw-nrfconnect-tfm - Skipped: Job was skipped as it succeeded in a previous run
    • ✅ test-fw-nrfconnect-thread - Skipped: Job was skipped as it succeeded in a previous run
    • ✅ test-fw-nrfconnect-zigbee - Skipped: Job was skipped as it succeeded in a previous run
    • ✅ test-sdk-find-my - Skipped: Job was skipped as it succeeded in a previous run
    • ✅ test-fw-nrfconnect-nrf-iot_mosh - Skipped: Job was skipped as it succeeded in a previous run
    • ✅ test-fw-nrfconnect-nrf-iot_positioning - Skipped: Job was skipped as it succeeded in a previous run
    • ✅ test-sdk-sidewalk - Skipped: Job was skipped as it succeeded in a previous run
    • ✅ test-sdk-wifi - Skipped: Job was skipped as it succeeded in a previous run
    • ✅ test-low-level - Skipped: Job was skipped as it succeeded in a previous run
    • ✅ test-fw-nrfconnect-nrf-iot_nrf_provisioning - Skipped: Job was skipped as it succeeded in a previous run
    • ✅ test-sdk-pmic-samples - Skipped: Job was skipped as it succeeded in a previous run
    • ✅ test-sdk-mcuboot - Skipped: Job was skipped as it succeeded in a previous run
    • ✅ test-sdk-dfu - Skipped: Job was skipped as it succeeded in a previous run
    • ⚠️ test-fw-nrfconnect-fw-update

Note: This message is automatically posted and updated by the CI

@michalek-no michalek-no force-pushed the nsib_nrf54 branch 3 times, most recently from ea131cb to f2c25e9 Compare August 20, 2024 07:49
@nvlsianpu
Copy link
Contributor

@michalek-no Can you rebase?

@michalek-no
Copy link
Contributor Author

rebase

@michalek-no
Copy link
Contributor Author

rebase

michalek-no and others added 10 commits November 5, 2024 08:30
Since the vector table of nRF54LX series is larger than before using it
is nice to have an offset between `0x400` and `0x800` to store `fw_info`
in to ensure you can tightly pack your application together with
firmware info. One downside of this is that this new offset is not
supported in any older version of NSIB.

Signed-off-by: Mateusz Michalek <[email protected]>
Added OTP region in partition manager for `nRF54L15X_ENGA` devices and
modified the secure boot storage partition to use OTP for NRF54L15.

Ref. NCSDK-25306

Signed-off-by: Mateusz Michalek <[email protected]>
Changed the implementation of bl_storage to be compatible with RRAMC and
FLASH/NVMC. Due to the limitations in the RRAM controller OTP can only
be written to by words not half-words as it can be in NVMC.

This means we need to change the way we handle certain cases in
`bl_storage.c`, `bl_validation.c` and `fw_info.c`. This commit moves
some of the abstractions into two separate files `bl_storage_nvmc.c` and
`bl_storage_rramc.c`. However there are multiple other changes needed
which are done by using `#ifdef`'s.

Ref. NCSDK-25306

Signed-off-by: Mateusz Michalek <[email protected]>
Changed the provisioning script to account for larger Life Cycle State
structures. Since we can only do word writes in nRF54LX life cycle
states needs to be stored in words. This increased the LCS struct by 1
word requiring us to change the way the provisioning script works.

This change adds the LCS size as a value to the CMake file which uses
the SOC to decide which size the LCS struct is which is then passed to
the python script through the `--lcs-state-size` argument.

Ref. NCSDK-25306

Signed-off-by: Mateusz Michalek <[email protected]>
Signed-off-by: Sigurd Hellesvik <[email protected]>
Instead of just failing on compilation this commit changes fprotect
requirements so that it prints out a warning and error in log.

Signed-off-by: Mateusz Michalek <[email protected]>
Selects NRFX_RRAMC symbol required by fprotect RRAM backend
on 54L15 platform.

Signed-off-by: Mateusz Michalek <[email protected]>
Adds bl_storage tests.

Signed-off-by: Mateusz Michalek <[email protected]>
Add nrf54l15dk to boot_chains configurations.

Signed-off-by: Grzegorz Chwierut <[email protected]>
adds another UART's uninit call.

Signed-off-by: Mateusz Michalek <[email protected]>
NRFX_NVMC is being selected conditionally as it is
not the one and only memory backend anymore.

Signed-off-by: Mateusz Michalek <[email protected]>
@github-actions github-actions bot added the changelog-entry-required Update changelog before merge. Remove label if entry is not needed or already added. label Nov 5, 2024
@annwoj
Copy link
Contributor

annwoj commented Nov 5, 2024

release notes tba to the #18192 PR

@annwoj annwoj added this to the 2.8.0 milestone Nov 5, 2024
@divipillai divipillai added the backport v2.8-branch auto-create a PR with same commits to v2.8-branch label Nov 5, 2024
int err = fprotect_area(PM_B0_ADDRESS, PM_B0_SIZE);
int err = 0;

if (IS_ENABLED(CONFIG_FPROTECT)) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why isn't this a ifdef?

int err = fprotect_area(PM_PROVISION_ADDRESS, PM_PROVISION_SIZE);
int err = 0;

if (IS_ENABLED(CONFIG_FPROTECT)) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why isn't this an ifdef?

Copy link
Contributor

@hellesvik-nordic hellesvik-nordic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM
I also tested dual bootloaders and MCUboot upgrade with this. That worked as expected.

@nvlsianpu
Copy link
Contributor

@frkv We need to merge that ASAP. #Ifdefry can be improved later.

@ns-tolu
Copy link

ns-tolu commented Nov 5, 2024

agreed with @nvlsianpu to merge this PR to main only.

@rlubos rlubos removed the backport v2.8-branch auto-create a PR with same commits to v2.8-branch label Nov 5, 2024
@rlubos rlubos removed this from the 2.8.0 milestone Nov 5, 2024
@rlubos rlubos merged commit f27f49d into nrfconnect:main Nov 5, 2024
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
changelog-entry-required Update changelog before merge. Remove label if entry is not needed or already added. doc-required PR must not be merged without tech writer approval.
Projects
None yet
Development

Successfully merging this pull request may close these issues.